import { GET_ARTICLE_LIST, GET_CHANNEL_LIST } from '../constants'

const initState = {
  channels: [],
  articles: {},
}
//
export default function article(state = initState, action) {
  if (action.type === GET_CHANNEL_LIST) {
    return {
      ...state,
      channels: action.list,
    }
  }
  if (action.type === GET_ARTICLE_LIST) {
    return {
      ...state,
      articles: action.articles,
    }
  }
  return state
}
